import { QXEvent } from "qx-util";
import { IParam, MultiEditViewPanelActionType, IMultiEditViewPanelAbility, IMultiEditViewPanelControllerParams, IMultiEditViewPanelStore, MultiEditViewPanelController, ICtrlEvent, IMultiEditViewPanelController, IMultiEditViewPanelModel } from "@/core";
import { useMultiEditViewPanelAction, useMultiEditViewPanelBasic, useMultiEditViewPanelControllerParams, useMultiEditViewPanelProps } from "@/hooks/widget/use-multi-editview-panel";
import { MeditviewpanelControlVO } from './main-multi-editview-panel-vo';
import { model } from "./main-multi-editview-panel-model";
import MultiEditViewPanelService from "@/core/modules/ctrl-service/multi-edit-view-panel-service";
// 基于template/src/widgets/{{appEntities}}/{{ctrls@MULTIEDITVIEWPANEL}}-multi-editview-panel/{{spinalCase ctrl.codeName}}-multi-editview-panel-hook.ts.hbs生成
/**
 * 获取输入参数
 *
 * @export
 * @return {*}
 */
export function useProps() {
	return {
		...useMultiEditViewPanelProps(),
	};
}

/**
 * 获取基础数据
 *
 * @export
 * @param {*} props
 * @return {*}
 */
export function useBasic(props: any) {
	return {
		...useMultiEditViewPanelBasic(model, props),
	};
}

/**
 * 获取行为
 *
 * @export
 */
export function useAction(controller: any) {
	return {
		...useMultiEditViewPanelAction(controller),
	};
}

/**
 * 获取控制器
 *
 * @export
 * @param {IParam} props
 * @param {QXEvent<ICtrlEvent<MultiEditViewPanelActionType, IMultiEditViewPanelAbility>>} evt
 * @return {*}
 */
export function useController(
	props: IParam,
	evt: QXEvent<ICtrlEvent<MultiEditViewPanelActionType, IMultiEditViewPanelAbility>>,
    otherParams: IParam = {},
): IMultiEditViewPanelController<IMultiEditViewPanelStore, IMultiEditViewPanelAbility> {
	const params: IMultiEditViewPanelControllerParams<MultiEditViewPanelActionType, IMultiEditViewPanelAbility> =
		useMultiEditViewPanelControllerParams<IMultiEditViewPanelStore, IMultiEditViewPanelModel>(model, props, evt, otherParams);
    const ctrlService = new MultiEditViewPanelService<MeditviewpanelControlVO>(MeditviewpanelControlVO, model.entityCodeName, { model });
  	Object.assign(params, { ctrlService });
  	return new MultiEditViewPanelController(params);
}